# -*- coding: utf-8 -*-

from PyQt4.QtGui import QWidget
from PyQt4.QtCore import SIGNAL, SLOT, pyqtSignature
from add_item_ui import Ui_frmAddItem
from produto_ctrl import ControllerProduto

class AddItem(QWidget, Ui_frmAddItem):
	def __init__(self):
		QWidget.__init__(self)
		self.setupUi(self)
		
		self.controler = ControllerProduto()
		self.connect(self.btnSalvar, SIGNAL('clicked()'), \
						self, SLOT('salvar()'))
		
	@pyqtSignature("")
	def salvar(self):
		self.controler.incluirProduto( \
			unicode(self.txtDescr.text()), \
			unicode(self.cmbRepo.currentText()), \
			unicode(self.cmbOrdem.currentText()), \
			unicode(self.txtUnMedida.text()), \
			unicode(self.txtEstoqueSeguranca.text()), \
			unicode(self.txtDataCriacao.dateTime().toString("dd/mm/yyyy")), \
			unicode(self.txtDataAtualizacao.dateTime().toString("dd/mm/yyyy")), \
			unicode(self.txtABC.text()), \
			unicode(self.txtLeadTime.text()), \
			unicode(self.txtEstoqueMin.text()), \
			unicode(self.txtLoteReposicao.text()), \
			unicode(self.txtMultiploLote.text()))
			